package Year21_Month12.day1203;

public class Soultion {
    class Solution {
        public String removeDuplicates(String s) {
            int pre = -1;
            char[] arr = s.toCharArray();
            for(int i = 0;i < arr.length;i++){
                if(pre >= 0 && arr[i] == arr[pre]){
                    pre--;
                }else{
                    pre++;
                    arr[pre] = arr[i];
                }
            }
            return String.copyValueOf(arr,0,pre+1);
        }
    }
}
